﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using makitRS.Core.Models.Reports;
using makitRS.Core.Reports;

namespace makitRS.WebUI.Controllers
{
    public class CategoryController : Controller
    {
        //
        // GET: /Category/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult List(int id)
        {
            Category cat = ReportManager.getCategory(id);

            if (cat == null)
            {
                return RedirectToAction("NotFound");
            } 
            else if (cat is SubCategoriesCategory)
            {
                return View("SubCatList", (SubCategoriesCategory)cat);
            }
            else
            {
                return View("ReportsList", (ReportsCategory)cat);
            }
        }

        public ActionResult NotFound()
        {
            return View();
        }
    }
}
